package com.szcinda.fitness.persistence;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.szcinda.fitness.persistence.BaseEntity;
import com.szcinda.fitness.persistence.DailyTrain;
import lombok.Data;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.validation.constraints.NotNull;

@Data
@Entity
public class TrainMovement extends BaseEntity {
    @NotNull(message = "动作名称不能为空")
    private String name;
    @NotNull(message = "动作图片不能为空")
    private String imgSrc;
    @NotNull(message = "动作强度不能为空")
    private int strongPercent;
    private String remark;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "train_id")
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private DailyTrain dailyTrain;
}
